package com.atguigu.gmall.cart.client;

/**
 * @Author: zm
 * @Date: 2021/8/23 17:55
 */

import com.atguigu.gmall.cart.client.impl.CartDegradeFeignClient;
import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.cart.CartInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * @author atguigu-mqx
 */
@FeignClient(value = "service-cart", fallback = CartDegradeFeignClient.class)
public interface CartFeignClient {

    // 添加商品到购物车
    @GetMapping("/api/cart/addToCart/{skuId}/{skuNum}")
    Result addToCart(@PathVariable("skuId") Long skuId, @PathVariable("skuNum") Integer skuNum);

    // 根据userId 获取选中列表
    @GetMapping("/api/cart/getCartCheckedList/{userId}")
    List<CartInfo> getCartCheckedList(@PathVariable(value = "userId") String userId);

    // 根据userId 获取购物车列表
    @GetMapping("/api/cart/loadCartCache/{userId}")
    Result loadCartToCache(@PathVariable("userId") String userId);
}
